﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace LayoutPlanning.Converters
{
   
   
    public class SubtractValues : IMultiValueConverter
    {
    public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
    {
        
        if (values.Length < 2 )
            return 0d;
        double s;
        double s2;
       double.TryParse(values[0].ToString(), out s);
            double.TryParse(values[1].ToString(), out s2);
        if (s2 < 0)
            return 0d;
        return s - s2;

    }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
